{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "d42f0f13-191d-4afc-9b2f-12cee8552be8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting docx\n",
      "  Downloading docx-0.2.4.tar.gz (54 kB)\n",
      "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m54.9/54.9 kB\u001b[0m \u001b[31m4.8 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0mm\n",
      "\u001b[?25h  Preparing metadata (setup.py) ... \u001b[?25ldone\n",
      "\u001b[?25hRequirement already satisfied: lxml in /home/kyle/anaconda3/lib/python3.11/site-packages (from docx) (4.9.3)\n",
      "Requirement already satisfied: Pillow>=2.0 in /home/kyle/anaconda3/lib/python3.11/site-packages (from docx) (10.2.0)\n",
      "Building wheels for collected packages: docx\n",
      "  Building wheel for docx (setup.py) ... \u001b[?25ldone\n",
      "\u001b[?25h  Created wheel for docx: filename=docx-0.2.4-py3-none-any.whl size=53894 sha256=5d1179542821b5da34a630d1e41105a8c8ca97d2025166fee3262dc678ebe480\n",
      "  Stored in directory: /home/kyle/.cache/pip/wheels/c1/3e/c3/e81c11effd0be5658a035947c66792dd993bcff317eae0e1ed\n",
      "Successfully built docx\n",
      "Installing collected packages: docx\n",
      "Successfully installed docx-0.2.4\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "pip install docx"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "877ba439-c9f1-43ff-bc45-64f1cc536f9f",
   "metadata": {},
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'exceptions'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[3], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mdocx\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Document\n\u001b[1;32m      2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mdocx\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mshared\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Pt\n\u001b[1;32m      3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mdocx\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01menum\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mtext\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m WD_PARAGRAPH_ALIGNMENT\n",
      "File \u001b[0;32m~/anaconda3/lib/python3.11/site-packages/docx.py:30\u001b[0m\n\u001b[1;32m     27\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mImportError\u001b[39;00m:\n\u001b[1;32m     28\u001b[0m     TAGS \u001b[38;5;241m=\u001b[39m {}\n\u001b[0;32m---> 30\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mexceptions\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;167;01mPendingDeprecationWarning\u001b[39;00m\n\u001b[1;32m     31\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mwarnings\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m warn\n\u001b[1;32m     33\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mlogging\u001b[39;00m\n",
      "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'exceptions'"
     ]
    }
   ],
   "source": [
    "from docx import Document\n",
    "from docx.shared import Pt\n",
    "from docx.enum.text import WD_PARAGRAPH_ALIGNMENT\n",
    "\n",
    "# 创建一个新的Word文档\n",
    "doc = Document()\n",
    "\n",
    "# 设置文档标题\n",
    "title = doc.add_heading('AtomGit 代码托管平台运营专区申请表', level=1)\n",
    "title.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER\n",
    "\n",
    "# 添加申请者基本信息部分\n",
    "doc.add_heading('申请者基本信息', level=2)\n",
    "\n",
    "fields_basic_info = [\n",
    "    \"申请单位名称: （请填写申请的地方政府、高校、开源社区或企业的名称）\",\n",
    "    \"单位性质: ☐ 地方政府 ☐ 高校 ☐ 开源社区 ☐ 企业\",\n",
    "    \"联系人姓名: （请填写联系人姓名）\",\n",
    "    \"联系人职务: （请填写联系人在单位中的职务）\",\n",
    "    \"联系人电话: （请填写联系人电话）\",\n",
    "    \"联系人邮箱: （请填写联系人邮箱）\"\n",
    "]\n",
    "\n",
    "for field in fields_basic_info:\n",
    "    doc.add_paragraph(field)\n",
    "\n",
    "# 添加申请运营专区信息部分\n",
    "doc.add_heading('申请运营专区信息', level=2)\n",
    "\n",
    "fields_zone_info = [\n",
    "    \"申请使用的运营专区名称: （请填写申请使用的专区名称）\",\n",
    "    \"申请使用的目的: （请简要描述申请使用运营专区的目的和预期效果）\",\n",
    "    \"宣传推广计划: （请详细描述计划在运营专区进行的宣传推广活动，包括活动内容、时间安排、目标群体等）\",\n",
    "    \"需要的技术支持: （请描述在使用运营专区过程中可能需要的技术支持，包括但不限于技术咨询、平台操作指导等）\"\n",
    "]\n",
    "\n",
    "for field in fields_zone_info:\n",
    "    doc.add_paragraph(field)\n",
    "\n",
    "# 添加特定要求部分\n",
    "doc.add_heading('特定要求', level=2)\n",
    "\n",
    "specific_requirements = [\n",
    "    \"资质证明（请根据单位性质提供相应的证明文件）:\",\n",
    "    \"a. 地方政府: 提供工委会投票结果或其他资质证明文件\",\n",
    "    \"b. 企业: 提供法人主体证明文件（如营业执照）\",\n",
    "    \"c. 高校: 提供学院知悉并同意的证明文件（如院系盖章的同意函）\",\n",
    "    \"d. 开源社区: 提供对某品牌使用的授权证明文件\"\n",
    "]\n",
    "\n",
    "for requirement in specific_requirements:\n",
    "    doc.add_paragraph(requirement)\n",
    "\n",
    "# 添加承诺与确认部分\n",
    "doc.add_heading('承诺与确认', level=2)\n",
    "\n",
    "commitments = [\n",
    "    \"信息真实性承诺: 本单位承诺以上填写的信息真实、准确。如有虚假信息，本单位愿意承担相关责任。\",\n",
    "    \"使用规则确认: 本单位已阅读并同意遵守 AtomGit 代码托管平台的使用规则及相关管理规定。如有违反，本单位愿意承担相应责任。\"\n",
    "]\n",
    "\n",
    "for commitment in commitments:\n",
    "    doc.add_paragraph(commitment)\n",
    "\n",
    "# 添加签名与日期部分\n",
    "doc.add_heading('签名与日期', level=2)\n",
    "\n",
    "signatures = [\n",
    "    \"联系人签名: （请联系人签名）\",\n",
    "    \"申请日期: （请填写申请日期）\"\n",
    "]\n",
    "\n",
    "for signature in signatures:\n",
    "    doc.add_paragraph(signature)\n",
    "\n",
    "# 保存文档\n",
    "file_path = \"/mnt/data/AtomGit_运营专区申请表.docx\"\n",
    "doc.save(file_path)\n",
    "\n",
    "file_path\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "b71c84ab-69ae-48a4-b619-73e99ba46642",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting python-docx\n",
      "  Using cached python_docx-1.1.2-py3-none-any.whl.metadata (2.0 kB)\n",
      "Requirement already satisfied: requests in /home/kyle/anaconda3/lib/python3.11/site-packages (2.31.0)\n",
      "Requirement already satisfied: lxml>=3.1.0 in /home/kyle/anaconda3/lib/python3.11/site-packages (from python-docx) (4.9.3)\n",
      "Requirement already satisfied: typing-extensions>=4.9.0 in /home/kyle/anaconda3/lib/python3.11/site-packages (from python-docx) (4.9.0)\n",
      "Requirement already satisfied: charset-normalizer<4,>=2 in /home/kyle/anaconda3/lib/python3.11/site-packages (from requests) (2.0.4)\n",
      "Requirement already satisfied: idna<4,>=2.5 in /home/kyle/anaconda3/lib/python3.11/site-packages (from requests) (3.4)\n",
      "Requirement already satisfied: urllib3<3,>=1.21.1 in /home/kyle/anaconda3/lib/python3.11/site-packages (from requests) (2.0.7)\n",
      "Requirement already satisfied: certifi>=2017.4.17 in /home/kyle/anaconda3/lib/python3.11/site-packages (from requests) (2024.2.2)\n",
      "Downloading python_docx-1.1.2-py3-none-any.whl (244 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m244.3/244.3 kB\u001b[0m \u001b[31m19.6 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
      "\u001b[?25hInstalling collected packages: python-docx\n",
      "Successfully installed python-docx-1.1.2\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "pip install python-docx requests"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "7a17e466-099d-43a5-9af0-2b79308f65cf",
   "metadata": {},
   "outputs": [],
   "source": [
    "from docx import Document\n",
    "from docx.shared import Inches\n",
    "\n",
    "# 创建一个新的文档对象\n",
    "doc = Document()\n",
    "\n",
    "# 添加标题\n",
    "doc.add_heading('AtomGit 代码托管平台运营专区申请表', level=1)\n",
    "\n",
    "# 添加申请者基本信息部分\n",
    "doc.add_heading('申请者基本信息', level=2)\n",
    "doc.add_paragraph('申请单位名称: （请填写申请的地方政府、高校、开源社区或企业的名称）')\n",
    "doc.add_paragraph('单位性质: ☐ 地方政府 ☐ 高校 ☐ 开源社区 ☐ 企业')\n",
    "doc.add_paragraph('联系人姓名: （请填写联系人姓名）')\n",
    "doc.add_paragraph('联系人职务: （请填写联系人在单位中的职务）')\n",
    "doc.add_paragraph('联系人电话: （请填写联系人电话）')\n",
    "doc.add_paragraph('联系人邮箱: （请填写联系人邮箱）')\n",
    "\n",
    "# 添加申请运营专区信息部分\n",
    "doc.add_heading('申请运营专区信息', level=2)\n",
    "doc.add_paragraph('申请使用的运营专区名称: （请填写申请使用的专区名称）')\n",
    "doc.add_paragraph('申请使用的目的: （请简要描述申请使用运营专区的目的和预期效果）')\n",
    "doc.add_paragraph('宣传推广计划: （请详细描述计划在运营专区进行的宣传推广活动，包括活动内容、时间安排、目标群体等）')\n",
    "doc.add_paragraph('需要的技术支持: （请描述在使用运营专区过程中可能需要的技术支持，包括但不限于技术咨询、平台操作指导等）')\n",
    "\n",
    "# 添加特定要求部分\n",
    "doc.add_heading('特定要求', level=2)\n",
    "doc.add_paragraph('资质证明（请根据单位性质提供相应的证明文件）:')\n",
    "doc.add_paragraph('a. 地方政府: 提供工委会投票结果或其他资质证明文件', style='List Bullet')\n",
    "doc.add_paragraph('b. 企业: 提供法人主体证明文件（如营业执照）', style='List Bullet')\n",
    "doc.add_paragraph('c. 高校: 提供学院知悉并同意的证明文件（如院系盖章的同意函）', style='List Bullet')\n",
    "doc.add_paragraph('d. 开源社区: 提供对某品牌使用的授权证明文件', style='List Bullet')\n",
    "\n",
    "# 添加承诺与确认部分\n",
    "doc.add_heading('承诺与确认', level=2)\n",
    "doc.add_paragraph('信息真实性承诺: 本单位承诺以上填写的信息真实、准确。如有虚假信息，本单位愿意承担相关责任。')\n",
    "doc.add_paragraph('使用规则确认: 本单位已阅读并同意遵守 AtomGit 代码托管平台的使用规则及相关管理规定。如有违反，本单位愿意承担相应责任。')\n",
    "\n",
    "# 添加签名与日期部分\n",
    "doc.add_heading('签名与日期', level=2)\n",
    "doc.add_paragraph('联系人签名: （请联系人签名）')\n",
    "doc.add_paragraph('申请日期: （请填写申请日期）')\n",
    "\n",
    "# 保存文档\n",
    "doc.save('AtomGit_运营专区申请表.docx')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5a601c46-93bd-4a76-a50f-bf024b7ba74b",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.7"
  },
  "widgets": {
   "application/vnd.jupyter.widget-state+json": {
    "state": {},
    "version_major": 2,
    "version_minor": 0
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
